<?php echo $this->element('left_column')?>
<?php $this->Html->addCrumb('Trang chủ','/')?>
<?php $this->Html->addCrumb('Đơn hàng đã đặt','/danh-sach-don-hang')?>
<?php $this->Html->addCrumb('Chi tiết đơn hàng')?>
<div class="mainColumn">
<table id="tableOrder" summary="Employee Pay Sheet">
	<thead>
		<tr>
			<th scope="col"><strong>Địa chỉ giao hàng</strong></th>			
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				<?php echo h($rs['OrderShipping']['name'])?><br /><?php echo h($rs['OrderShipping']['address'])?><br /><?php echo h($rs['Customer']['email'])?> - <?php echo h($rs['OrderShipping']['tel'])?>
			</td>			
		</tr>
	</tbody>
</table>
<table id="tableOrder" summary="Employee Pay Sheet">
	<thead>
		<tr>
			<th scope="col"><strong>Phương thức vận chuyển</strong></th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
			<?php echo h($rs['ShippingType']['name'])?> <br/>
			<?php echo nl2br(h($rs['ShippingType']['description']))?>				
			</td>
		</tr>
	</tbody>
</table>
<table id="tableOrder" summary="Employee Pay Sheet">
	<thead>
		<tr>
			<th colspan="7" scope="col"><strong>Kiểm tra việc mua hàng</strong></th>
		</tr>
		<tr>
			<th scope="col"><strong>Mã SP</strong></th>
			<th scope="col"><strong>Tên sản phẩm</strong></th>
			<th scope="col"><strong>Kích cỡ</strong></th>			
			<th scope="col" style="text-align:center;"><strong>Số lượng</strong></th>
			<th scope="col" style="text-align:right;"><strong>Đơn giá</strong></th>
			<th scope="col" style="text-align:right;"><strong>Thành tiền</strong></th>
		</tr>
	</thead>
	<tbody>
	<?php
	$shipping_price = $subtotal = 0;	
	foreach($rs['OrderDetail'] as $item):
		$subtotal += $item['price'] * $item['amount'];
	?>
		<tr>
			<td><?php echo $item['product_code']?></td>
			<td><?php echo $item['product_name']?></td>
			<td><?php echo $item['size_name']?></td>
			<td><?php echo $item['amount']?></td>
			<td><?php echo number_format($item['price'])?> VND</td>
			<td style="text-align:right;"><?php echo number_format($item['price'] * $item['amount'])?> VND</td>			
		</tr>
	<?php endforeach;?>		
		<tr>
			<td colspan="6" class="tableOrderHeader"><strong>Tóm tắt việc thanh toán</strong></td>
		</tr>
		<tr>
			<td colspan="6" style="text-align:right;"><strong>Tổng giá trị đơn hàng</strong></td>
		</tr>
		<tr>
			<td colspan="5" style="text-align:right;"><strong>Giá trị hàng hóa</strong></td>
			<td style="text-align:right;"><?php echo number_format($subtotal)?> VND</td>
		</tr>
		<tr>
			<td colspan="5" style="text-align:right;"><strong>Vận chuyển và đóng gói</strong></td>
			<td style="text-align:right;"><?php echo $shipping_price?> VND</td>
		</tr>
		<tr>
			<td colspan="6" style="text-align:right;"><strong>Tổng giá trị hàng hóa thực tế</strong></td>
		</tr>
		<tr>
			<td colspan="6" style="text-align:right;"><?php echo number_format($subtotal + $shipping_price)?> VND</td>
		</tr>
	</tbody>
</table>
</div>